package com.itheima.homework9;

import java.util.HashMap;
import java.util.Set;

public class Test5 {
    public static void main(String[] args) {
        double sum=0;
        HashMap<Commodity,Integer> hm=new HashMap<>();
        hm.put(new Commodity("华为手机P80",8888.0),3);
        hm.put(new Commodity("小米手环",1666.0),10);
        hm.put(new Commodity("小米智能音箱",199.0),20);
        hm.put(new Commodity("电动牙刷",50.0),40);
        Set<Commodity> keys = hm.keySet();
        for (Commodity key : keys) {

            sum+=key.getPrice()*hm.get(key);
        }
        System.out.println(sum);
    }
}
